package PTA;

import java.util.Scanner;

public class PTA_7_57 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        int flag = 0;
        String[] str =S.split("\\.",4);
        for (int i = 0; i < str.length; i++) {
            if((Integer.parseInt(str[i])>255)||(Integer.parseInt(str[i])<0)){
                flag = -1;
                break;
            }
        }
        if(flag == -1) {
            System.out.println(S + "不是合法的IP地址");
        }
        else {
            System.out.println(S + "是合法的IP地址");
        }
    }
}
